Page({
  /** 页面的初始数据 */
  data: {
    currentValue: 0,
    world:0,
    count: 0, //倒计时秒数
    show_button: false, //初始不显示跳过按钮
    //图片数据
    world1:'cloud://cloud2-9gomot6xb9909364.636c-cloud2-9gomot6xb9909364-1305292962/蓝天科普3.0存储/world/world1.png',
    world2:'cloud://cloud2-9gomot6xb9909364.636c-cloud2-9gomot6xb9909364-1305292962/蓝天科普3.0存储/world/world4.png',
    world3:'cloud://cloud2-9gomot6xb9909364.636c-cloud2-9gomot6xb9909364-1305292962/蓝天科普3.0存储/world/world2.png',
    world4:'cloud://cloud2-9gomot6xb9909364.636c-cloud2-9gomot6xb9909364-1305292962/蓝天科普3.0存储/world/组件5.png',
    world5:'cloud://cloud2-9gomot6xb9909364.636c-cloud2-9gomot6xb9909364-1305292962/蓝天科普3.0存储/world/world3.png',
    world6:'cloud://cloud2-9gomot6xb9909364.636c-cloud2-9gomot6xb9909364-1305292962/蓝天科普3.0存储/world/组件7.png',
    world7:'cloud://cloud2-9gomot6xb9909364.636c-cloud2-9gomot6xb9909364-1305292962/蓝天科普3.0存储/world/world5.png',
    //屏幕
    Pwidth: '',
    PHeight:'',
  },
  //初始化进入程序
  onLoad() { 
    const that = this
    wx.getSystemInfo({
    success(res) {
      //console.log(res)
      that.setData({
        Pwidth: res.screenWidth,
        PHeight: res.screenHeight,
      })
    }
  })
    this.countDown();
    this.show_button();
  },
  //延迟一秒显示跳转按钮
  show_button() {
    let that = this
    setTimeout(function () {
      that.setData({
        show_button: true
      })
    }, 1000)
  },
  //正式进入world界面
  getworld() {
    clearInterval(this.data.time); //清除倒计时
   this.setData({
     world:1
   })
  },
  //倒计时计数
  countDown: function () {
    let that = this;
    let count = that.data.count;
    that.data.time = setInterval(function () {
      if (count > 0) {
        count--
        that.setData({
          count: count,
          currentValue:5-count
        })
      } else {
        that.setData({
          count: count,
          currentValue:5-count
        })
        that.getworld();
        clearInterval(that.data.time)
      }
    }, 1000)
  },
})